repo.or.cz
/
andmenj-acm.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
Cleaning up
[andmenj-acm.git]
/
11452 - Dancing the cheeky-cheeky
/
11452.2.cpp
blob
36a21828e88de8921fd3c43e94e48cea3ec475b0
1
/*
2
Accepted
3
*/
4
#include <iostream>
5
6
using namespace
std
;
7
8
int
main
(){
9
int
C
;
10
string s
;
11
cin
>>
C
;
12
getline
(
cin
,
s
);
13
while
(
C
--){
14
getline
(
cin
,
s
);
15
16
int
n
=
s
.
size
();
17
int
i
,
j
;
18
for
(
i
=
1
;
i
<=
n
; ++
i
){
19
string
first
(
s
.
substr
(
0
,
i
)),
second
(
s
.
substr
(
i
,
i
));
20
if
(
first
==
second
&&
n
-
2
*
i
<
i
){
21
//cout << "Solution found using first " << i << " chars." << endl;
22
break
;
23
}
24
}
25
26
j
=
n
-
2
*
i
;
27
for
(
int
k
=
0
;
k
<
8
; ++
k
){
28
cout
<<
s
[
j
];
29
j
= (
j
+
1
)%(
2
*
i
);
30
}
31
cout
<<
"..."
<<
endl
;
32
}
33
return
0
;
34
}